package Turma.Jogo;

import android.framework.Game;
import android.framework.Graphics.PixmapFormat;

public class ArkanoidBall extends GameObject

{
	public float speedx, speedy;
	Game game;
	
	public ArkanoidBall(float x, float y, int w, int h, float speedx, float speedy, Game game)
	{
		super(game.getGraphics(), "ball.png", PixmapFormat.ARGB4444, x, y, w, h);
		this.speedx = speedx;
		this.game = game;
		this.speedy = speedy;
	}
	
	public void Update()
	{
        this.x += this.speedx;
        this.y += this.speedy;

        if (this.x < 0 || this.x > game.getGraphics().getWidth() - this.w)
        {
            this.speedx *= -1;
        }

        if (this.y < 0)
        {
            this.speedy *= -1;
        }
    }
}